frappe.ui.form.on('Item', {

    setup: function (frm) {
		frm.set_query('custom_service_item', function (doc) {			
			return {
				filters: {
					'is_stock_item': 0,
				}
			}
		});
	
		// 采购默认单位只能选到该物料已经设置的多单位
		frm.set_query("purchase_uom", function (doc) {
      
			return {
			  query:
				"erpnext.accounts.doctype.pricing_rule.pricing_rule.get_item_uoms",
			  filters: {
				value: doc.item_code,
				apply_on: "Item Code",
			  },
			};
		  });
		  
	  // 	销售默认单位只能选到该物料已经设置的多单位
		  frm.set_query("sales_uom", function (doc) {
			
			return {
			  query:
				"erpnext.accounts.doctype.pricing_rule.pricing_rule.get_item_uoms",
			  filters: {
				value: doc.item_code,
				apply_on: "Item Code",
			  },
			};
		  });
	
	},
})